import time

from selenium.webdriver.common.by import By

from common.Utils import forum


class forumHome:
    driver = ""
    def __init__(self):
        self.url = "http://127.0.0.1:58080/index.html"
        self.driver = forum.driver
        self.driver.get(self.url)

    def CheckElement(self):
        time.sleep(1)
        # 进行元素查找

        self.driver.find_element(By.CSS_SELECTOR,
                                 "#artical-items-body > div:nth-child(1) > div > div.col > div.text-truncate > a > strong")
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_nickname")
        self.driver.find_element(By.CSS_SELECTOR, "#topBoardList > li:nth-child(2) > a")
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#bit-forum-content > div.page-header.d-print-none > div > div > div.col-auto.ms-auto.d-print-none > div > a.btn.btn-primary.d-none.d-sm-inline-block.article_post")
        self.driver.find_element(By.CSS_SELECTOR,
                                 "body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input")
        # 进行截图
        forum.GetScreenShot()
